﻿using Nemerle.Collections;
using Nemerle.Peg;
using Nemerle.Text;
using Nemerle.Utility;

using System;
using System.Collections.Generic;
using System.Linq;

namespace Nemerle2.Compiler
{
  /// <summary>
  /// Description of PCustomAttribute.
  /// </summary>
  [Record]
  public variant PCustomAttribute : PAst
  {
    | Content { Name  : Splicable; Args : PArguments; }
    /// The code from quasi-quotation.
    | Expr    { Code  : PExpr; }
    | Error   { Msg   : Msg; }

    public override ToString() : string
    {
      match (this)
      {
        | Content(name, _)  => name.ToString()
        | Expr(code)        => $"$$($code)"
        | Error(msg)        => msg.ToString()
      }
    }
  }
}
